```html
<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Netty协议编解码深度解析</title>
    <link href="https://cdn.staticfile.org/font-awesome/6.4.0/css/all.min.css" rel="stylesheet">
    <link href="https://cdn.staticfile.org/tailwindcss/2.2.19/tailwind.min.css" rel="stylesheet">
    <link href="https://fonts.googleapis.com/css2?family=Noto+Serif+SC:wght@400;500;600;700&family=Noto+Sans+SC:wght@300;400;500;700&display=swap" rel="stylesheet">
    <style>
        body {
            font-family: 'Noto Sans SC', Tahoma, Arial, Roboto, "Droid Sans", "Helvetica Neue", "Droid Sans Fallback", "Heiti SC", "Hiragino Sans GB", Simsun, sans-serif;
            color: #333;
            line-height: 1.6;
        }
        h1, h2, h3, h4 {
            font-family: 'Noto Serif SC', serif;
            font-weight: 600;
        }
        .hero-gradient {
            background: linear-gradient(135deg, #6e8efb 0%, #4a6cf7 100%);
        }
        .code-block {
            background: #282c34;
            border-radius: 8px;
            position: relative;
        }
        .code-header {
            background: #1e2227;
            border-top-left-radius: 8px;
            border-top-right-radius: 8px;
            padding: 8px 16px;
            color: #abb2bf;
            display: flex;
            align-items: center;
        }
        .code-dots {
            display: flex;
            gap: 6px;
            margin-right: 12px;
        }
        .code-dot {
            width: 12px;
            height: 12px;
            border-radius: 50%;
        }
        .dot-red { background: #ff5f56; }
        .dot-yellow { background: #ffbd2e; }
        .dot-green { background: #27c93f; }
        .code-body {
            padding: 16px;
            overflow-x: auto;
        }
        .code-keyword { color: #c678dd; }
        .code-type { color: #e5c07b; }
        .code-string { color: #98c379; }
        .code-comment { color: #5c6370; font-style: italic; }
        .code-method { color: #61afef; }
        .card-hover:hover {
            transform: translateY(-5px);
            box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
        }
        .timeline-item {
            position: relative;
            padding-left: 30px;
            margin-bottom: 30px;
        }
        .timeline-item:before {
            content: "";
            position: absolute;
            left: 0;
            top: 5px;
            width: 16px;
            height: 16px;
            border-radius: 50%;
            background: #4a6cf7;
            border: 3px solid white;
            box-shadow: 0 0 0 2px #4a6cf7;
        }
        .timeline-item:after {
            content: "";
            position: absolute;
            left: 7px;
            top: 25px;
            height: calc(100% - 20px);
            width: 2px;
            background: #e5e7eb;
        }
        .timeline-item:last-child:after {
            display: none;
        }
    </style>
</head>
<body class="bg-gray-50">
    <!-- Hero Section -->
    <section class="hero-gradient text-white py-20 px-4 md:py-32">
        <div class="container mx-auto max-w-6xl">
            <div class="flex flex-col md:flex-row items-center">
                <div class="md:w-1/2 mb-10 md:mb-0">
                    <h1 class="text-4xl md:text-5xl font-bold mb-6">Netty协议编解码深度解析</h1>
                    <p class="text-xl md:text-2xl mb-8 opacity-90">构建高效网络通信架构的核心组件</p>
                    <div class="flex flex-wrap gap-4">
                        <a href="#intro" class="bg-white text-blue-600 px-6 py-3 rounded-lg font-medium hover:bg-blue-50 transition duration-300">
                            <i class="fas fa-book-open mr-2"></i>开始阅读
                        </a>
                        <a href="#examples" class="border-2 border-white text-white px-6 py-3 rounded-lg font-medium hover:bg-white hover:text-blue-600 transition duration-300">
                            <i class="fas fa-code mr-2"></i>代码示例
                        </a>
                    </div>
                </div>
                <div class="md:w-1/2">
                    <div class="relative">
                        <div class="absolute -top-6 -left-6 w-32 h-32 bg-yellow-400 rounded-full opacity-20 animate-pulse"></div>
                        <div class="absolute -bottom-6 -right-6 w-32 h-32 bg-purple-500 rounded-full opacity-20 animate-pulse"></div>
                        <div class="relative bg-white rounded-xl shadow-2xl overflow-hidden">
                            <div class="code-header">
                                <div class="code-dots">
                                    <div class="code-dot dot-red"></div>
                                    <div class="code-dot dot-yellow"></div>
                                    <div class="code-dot dot-green"></div>
                                </div>
                                <span>NettyCodecExample.java</span>
                            </div>
                            <div class="code-body">
                                <pre class="text-sm text-gray-200">
<span class="code-keyword">public class</span> <span class="code-type">MyMessageEncoder</span> <span class="code-keyword">extends</span> <span class="code-type">MessageToByteEncoder</span>&lt;<span class="code-type">MyMessage</span>&gt; {
    @<span class="code-type">Override</span>
    <span class="code-keyword">protected void</span> <span class="code-method">encode</span>(<span class="code-type">ChannelHandlerContext</span> ctx, <span class="code-type">MyMessage</span> msg, <span class="code-type">ByteBuf</span> out) {
        out.writeInt(msg.getId());
        out.writeCharSequence(msg.getName(), <span class="code-type">CharsetUtil</span>.UTF_8);
    }
}</pre>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </section>

    <!-- Main Content -->
    <div class="container mx-auto max-w-6xl px-4 py-16">
        <!-- Introduction -->
        <section id="intro" class="mb-20">
            <h2 class="text-3xl font-bold mb-6 text-gray-800 border-l-4 border-blue-500 pl-4">Netty编解码机制概述</h2>
            <div class="bg-white rounded-xl shadow-md p-8 mb-8">
                <p class="text-lg mb-6">Netty 的协议编解码是其高效网络通信架构的重要组成部分。通过自定义编解码器（Codec），Netty 可以处理各种网络协议的传输。Netty 主要使用 <code class="bg-gray-100 px-2 py-1 rounded">ChannelHandler</code> 来实现编解码功能，<code class="bg-gray-100 px-2 py-1 rounded">ChannelHandler</code> 是 Netty 的核心概念之一，它用于处理 I/O 操作、消息编解码、异常处理等。</p>
                
                <div class="flex flex-col md:flex-row gap-8 mt-10">
                    <div class="md:w-1/2 bg-blue-50 p-6 rounded-lg">
                        <div class="flex items-center mb-4">
                            <div class="bg-blue-100 p-3 rounded-full mr-4">
                                <i class="fas fa-arrow-down text-blue-600 text-xl"></i>
                            </div>
                            <h3 class="text-xl font-semibold">解码器 (Decoder)</h3>
                        </div>
                        <p>将接收到的字节数组（ByteBuf）转换回应用层的 Java 对象。解决"如何从网络中读取和理解数据"的问题。</p>
                    </div>
                    <div class="md:w-1/2 bg-purple-50 p-6 rounded-lg">
                        <div class="flex items-center mb-4">
                            <div class="bg-purple-100 p-3 rounded-full mr-4">
                                <i class="fas fa-arrow-up text-purple-600 text-xl"></i>
                            </div>
                            <h3 class="text-xl font-semibold">编码器 (Encoder)</h3>
                        </div>
                        <p>将应用层的数据（通常是 Java 对象）转换为字节数组（ByteBuf）以便通过网络发送。解决"如何将数据准备好发送到网络"的问题。</p>
                    </div>
                </div>
            </div>
        </section>

        <!-- Code Examples -->
        <section id="examples" class="mb-20">
            <h2 class="text-3xl font-bold mb-6 text-gray-800 border-l-4 border-blue-500 pl-4">核心实现细节</h2>
            
            <div class="grid md:grid-cols-2 gap-8 mb-12">
                <!-- Encoder Card -->
                <div class="bg-white rounded-xl shadow-md overflow-hidden transition duration-300 card-hover">
                    <div class="bg-blue-600 text-white px-6 py-4">
                        <h3 class="text-xl font-semibold flex items-center">
                            <i class="fas fa-lock mr-3"></i>编码器实现
                        </h3>
                    </div>
                    <div class="p-6">
                        <p class="mb-4">编码器的核心任务是将 Java 对象转换为字节流。Netty 提供了 <code class="bg-gray-100 px-1 py-0.5 rounded">MessageToByteEncoder</code> 作为编码器的基础类。</p>
                        
                        <div class="code-block mt-4">
                            <div class="code-header">
                                <div class="code-dots">
                                    <div class="code-dot dot-red"></div>
                                    <div class="code-dot dot-yellow"></div>
                                    <div class="code-dot dot-green"></div>
                                </div>
                                <span>MyMessageEncoder.java</span>
                            </div>
                            <div class="code-body">
                                <pre class="text-sm text-gray-200">
<span class="code-keyword">public class</span> <span class="code-type">MyMessageEncoder</span> <span class="code-keyword">extends</span> <span class="code-type">MessageToByteEncoder</span>&lt;<span class="code-type">MyMessage</span>&gt; {
    @<span class="code-type">Override</span>
    <span class="code-keyword">protected void</span> <span class="code-method">encode</span>(<span class="code-type">ChannelHandlerContext</span> ctx, 
                          <span class="code-type">MyMessage</span> msg, 
                          <span class="code-type">ByteBuf</span> out) {
        <span class="code-comment">// 将MyMessage对象转换为字节流</span>
        out.writeInt(msg.getId());
        out.writeCharSequence(msg.getName(), 
            <span class="code-type">CharsetUtil</span>.UTF_8);
    }
}</pre>
                            </div>
                        </div>
                    </div>
                </div>

                <!-- Decoder Card -->
                <div class="bg-white rounded-xl shadow-md overflow-hidden transition duration-300 card-hover">
                    <div class="bg-purple-600 text-white px-6 py-4">
                        <h3 class="text-xl font-semibold flex items-center">
                            <i class="fas fa-unlock mr-3"></i>解码器实现
                        </h3>
                    </div>
                    <div class="p-6">
                        <p class="mb-4">解码器的核心任务是将字节流转换为 Java 对象。Netty 提供了 <code class="bg-gray-100 px-1 py-0.5 rounded">ByteToMessageDecoder</code> 作为解码器的基础类。</p>
                        
                        <div class="code-block mt-4">
                            <div class="code-header">
                                <div class="code-dots">
                                    <div class="code-dot dot-red"></div>
                                    <div class="code-dot dot-yellow"></div>
                                    <div class="code-dot dot-green"></div>
                                </div>
                                <span>MyMessageDecoder.java</span>
                            </div>
                            <div class="code-body">
                                <pre class="text-sm text-gray-200">
<span class="code-keyword">public class</span> <span class="code-type">MyMessageDecoder</span> <span class="code-keyword">extends</span> <span class="code-type">ByteToMessageDecoder</span> {
    @<span class="code-type">Override</span>
    <span class="code-keyword">protected void</span> <span class="code-method">decode</span>(<span class="code-type">ChannelHandlerContext</span> ctx, 
                          <span class="code-type">ByteBuf</span> in, 
                          <span class="code-type">List</span>&lt;<span class="code-type">Object</span>&gt; out) {
        <span class="code-comment">// 确保有足够的数据可供解码</span>
        <span class="code-keyword">if</span> (in.readableBytes() &lt; 4) {
            <span class="code-keyword">return</span>;  <span class="code-comment">// 数据不足，等待更多数据</span>
        }

        <span class="code-keyword">int</span> id = in.readInt();
        <span class="code-type">String</span> name = in.readCharSequence(
            in.readableBytes(), 
            <span class="code-type">CharsetUtil</span>.UTF_8).toString();
        <span class="code-type">MyMessage</span> msg = <span class="code-keyword">new</span> <span class="code-type">MyMessage</span>(id, name);
        out.add(msg);  <span class="code-comment">// 将解码后的消息添加到out列表中</span>
    }
}</pre>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </section>

        <!-- Pipeline Flow -->
        <section class="mb-20">
            <h2 class="text-3xl font-bold mb-8 text-gray-800 border-l-4 border-blue-500 pl-4">ChannelPipeline 中的编解码流程</h2>
            
            <div class="bg-white rounded-xl shadow-md p-8 mb-8">
                <p class="text-lg mb-6">在 Netty 中，<code class="bg-gray-100 px-2 py-1 rounded">ChannelPipeline</code> 是一个处理器链，所有的数据处理逻辑（包括编解码）都通过 <code class="bg-gray-100 px-2 py-1 rounded">ChannelPipeline</code> 传递。</p>
                
                <div class="code-block mt-6">
                    <div class="code-header">
                        <div class="code-dots">
                            <div class="code-dot dot-red"></div>
                            <div class="code-dot dot-yellow"></div>
                            <div class="code-dot dot-green"></div>
                        </div>
                        <span>PipelineSetup.java</span>
                    </div>
                    <div class="code-body">
                        <pre class="text-sm text-gray-200">
<span class="code-keyword">public class</span> <span class="code-type">ServerInitializer</span> <span class="code-keyword">extends</span> <span class="code-type">ChannelInitializer</span>&lt;<span class="code-type">SocketChannel</span>&gt; {
    @<span class="code-type">Override</span>
    <span class="code-keyword">protected void</span> <span class="code-method">initChannel</span>(<span class="code-type">SocketChannel</span> ch) {
        <span class="code-type">ChannelPipeline</span> pipeline = ch.pipeline();
        
        <span class="code-comment">// 添加解码器</span>
        pipeline.addLast(<span class="code-keyword">new</span> <span class="code-type">MyMessageDecoder</span>());
        
        <span class="code-comment">// 添加编码器</span>
        pipeline.addLast(<span class="code-keyword">new</span> <span class="code-type">MyMessageEncoder</span>());
        
        <span class="code-comment">// 添加业务逻辑处理器</span>
        pipeline.addLast(<span class="code-keyword">new</span> <span class="code-type">ServerHandler</span>());
    }
}</pre>
                    </div>
                </div>
                
                <div class="mt-10">
                    <h3 class="text-xl font-semibold mb-4 flex items-center text-gray-700">
                        <i class="fas fa-project-diagram mr-2 text-blue-500"></i>数据流示意图
                    </h3>
                    <div class="bg-gray-50 p-6 rounded-lg">
                        <div class="flex justify-center">
                            <div class="text-center">
                                <div class="flex items-center justify-center mb-4">
                                    <div class="bg-blue-100 text-blue-600 rounded-full w-12 h-12 flex items-center justify-center">
                                        <i class="fas fa-network-wired text-xl"></i>
                                    </div>
                                    <div class="mx-4">
                                        <i class="fas fa-arrow-right text-gray-400 text-xl"></i>
                                    </div>
                                    <div class="bg-purple-100 text-purple-600 rounded-full w-12 h-12 flex items-center justify-center">
                                        <i class="fas fa-lock text-xl"></i>
                                    </div>
                                    <div class="mx-4">
                                        <i class="fas fa-arrow-right text-gray-400 text-xl"></i>
                                    </div>
                                    <div class="bg-green-100 text-green-600 rounded-full w-12 h-12 flex items-center justify-center">
                                        <i class="fas fa-code text-xl"></i>
                                    </div>
                                    <div class="mx-4">
                                        <i class="fas fa-arrow-right text-gray-400 text-xl"></i>
                                    </div>
                                    <div class="bg-yellow-100 text-yellow-600 rounded-full w-12 h-12 flex items-center justify-center">
                                        <i class="fas fa-server text-xl"></i>
                                    </div>
                                </div>
                                <div class="flex justify-between text-sm text-gray-600 mt-2">
                                    <div class="w-1/4 text-center">网络数据</div>
                                    <div class="w-1/4 text-center">解码器</div>
                                    <div class="w-1/4 text-center">业务处理</div>
                                    <div class="w-1/4 text-center">编码器</div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </section>

        <!-- ByteBuf Section -->
        <section class="mb-20">
            <h2 class="text-3xl font-bold mb-8 text-gray-800 border-l-4 border-blue-500 pl-4">ByteBuf 的核心作用</h2>
            
            <div class="bg-white rounded-xl shadow-md p-8">
                <div class="flex flex-col md:flex-row gap-8">
                    <div class="md:w-1/2">
                        <h3 class="text-xl font-semibold mb-4 text-gray-700">ByteBuf 设计特点</h3>
                        <ul class="space-y-3">
                            <li class="flex items-start">
                                <div class="bg-blue-100 text-blue-600 p-1 rounded-full mr-3 mt-1">
                                    <i class="fas fa-check text-xs"></i>
                                </div>
                                <span>动态容量调整，无需预先确定大小</span>
                            </li>
                            <li class="flex items-start">
                                <div class="bg-blue-100 text-blue-600 p-1 rounded-full mr-3 mt-1">
                                    <i class="fas fa-check text-xs"></i>
                                </div>
                                <span>读写索引分离，减少数据复制</span>
                            </li>
                            <li class="flex items-start">
                                <div class="bg-blue-100 text-blue-600 p-1 rounded-full mr-3 mt-1">
                                    <i class="fas fa-check text-xs"></i>
                                </div>
                                <span>支持池化技术，减少内存分配开销</span>
                            </li>
                            <li class="flex items-start">
                                <div class="bg-blue-100 text-blue-600 p-1 rounded-full mr-3 mt-1">
                                    <i class="fas fa-check text-xs"></i>
                                </div>
                                <span>零拷贝支持，提升性能</span>
                            </li>
                            <li class="flex items-start">
                                <div class="bg-blue-100 text-blue-600 p-1 rounded-full mr-3 mt-1">
                                    <i class="fas fa-check text-xs"></i>
                                </div>
                                <span>丰富的API支持各类数据读写</span>
                            </li>
                        </ul>
                    </div>
                    <div class="md:w-1/2">
                        <h3 class="text-xl font-semibold mb-4 text-gray-700">常用操作示例</h3>
                        <div class="code-block">
                            <div class="code-header">
                                <div class="code-dots">
                                    <div class="code-dot dot-red"></div>
                                    <div class="code-dot dot-yellow"></div>
                                    <div class="code-dot dot-green"></div>
                                </div>
                                <span>ByteBufOperations.java</span>
                            </div>
                            <div class="code-body">
                                <pre class="text-sm text-gray-200">
<span class="code-comment">// 创建ByteBuf</span>
<span class="code-type">ByteBuf</span> buffer = <span class="code-type">ByteBufAllocator</span>.DEFAULT.buffer();

<span class="code-comment">// 写入数据</span>
buffer.writeInt(<span class="code-number">123</span>);
buffer.writeBytes(<span class="code-string">"Hello"</span>.getBytes());

<span class="code-comment">// 读取数据</span>
<span class="code-keyword">int</span> num = buffer.readInt();
<span class="code-type">byte</span>[] bytes = <span class="code-keyword">new</span> <span class="code-type">byte</span>[buffer.readableBytes()];
buffer.readBytes(bytes);

<span class="code-comment">// 释放资源</span>
buffer.release();</pre>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </section>

        <!-- Best Practices -->
        <section class="mb-20">
            <h2 class="text-3xl font-bold mb-8 text-gray-800 border-l-4 border-blue-500 pl-4">最佳实践与性能优化</h2>
            
            <div class="bg-white rounded-xl shadow-md overflow-hidden">
                <div class="bg-gradient-to-r from-blue-500 to-purple-600 text-white px-6 py-4">
                    <h3 class="text-xl font-semibold flex items-center">
                        <i class="fas fa-star mr-3"></i>编解码器开发指南
                    </h3>
                </div>
                <div class="p-8">
                    <div class="grid md:grid-cols-2 gap-8">
                        <div>
                            <h4 class="text-lg font-semibold mb-3 text-gray-700 flex items-center">
                                <i class="fas fa-check-circle text-green-500 mr-2"></i>编码器最佳实践
                            </h4>
                            <ul class="space-y-3 text-gray-600">
                                <li class="flex items-start">
                                    <div class="bg-blue-100 text-blue-600 p-1 rounded-full mr-3 mt-1">
                                        <i class="fas fa-check text-xs"></i>
                                    </div>
                                    <span>明确指定处理的类型参数</span>
                                </li>
                                <li class="flex items-start">
                                    <div class="bg-blue-100 text-blue-600 p-1 rounded-full mr-3 mt-1">
                                        <i class="fas fa-check text-xs"></i>
                                    </div>
                                    <span>考虑使用对象池减少GC压力</span>
                                </li>
                                <li class="flex items-start">
                                    <div class="bg-blue-100 text-blue-600 p-1 rounded-full mr-3 mt-1">
                                        <i class="fas fa-check text-xs"></i>
                                    </div>
                                    <span>合理预估缓冲区大小</span>
                                </li>
                                <li class="flex items-start">
                                    <div class="bg-blue-100 text-blue-600 p-1 rounded-full mr-3 mt-1">
                                        <i class="fas fa-check text-xs"></i>
                                    </div>
                                    <span>实现异常处理逻辑</span>
                                </li>
                            </ul>
                        </div>
                        <div>
                            <h4 class="text-lg font-semibold mb-3 text-gray-700 flex items-center">
                                <i class="fas fa-check-circle text-green-500 mr-2"></i>解码器最佳实践
                            </h4>
                            <ul class="space-y-3 text-gray-600">
                                <li class="flex items-start">
                                    <div class="bg-purple-100 text-purple-600 p-1 rounded-full mr-3 mt-1">
                                        <i class="fas fa-check text-xs"></i>
                                    </div>
                                    <span>注意检查可读字节数</span>
                                </li>
                                <li class="flex items-start">
                                    <div class="bg-purple-100 text-purple-600 p-1 rounded-full mr-3 mt-1">
                                        <i class="fas fa-check text-xs"></i>
                                    </div>
                                    <span>考虑使用累积模式处理半包</span>
                                </li>
                                <li class="flex items-start">
                                    <div class="bg-purple-100 text-purple-600 p-1 rounded-full mr-3 mt-1">
                                        <i class="fas fa-check text-xs"></i>
                                    </div>
                                    <span>实现协议升级支持</span>
                                </li>
                                <li class="flex items-start">
                                    <div class="bg-purple-100 text-purple-600 p-1 rounded-full mr-3 mt-1">
                                        <i class="fas fa-check text-xs"></i>
                                    </div>
                                    <span>添加校验和验证</span>
                                </li>
                            </ul>
                        </div>
                    </div>
                    
                    <div class="mt-10">
                        <h4 class="text-lg font-semibold mb-4 text-gray-700">性能优化时间线</h4>
                        <div class="timeline-item">
                            <h5 class="font-semibold text-gray-800">1. 选择合适的基础类</h5>
                            <p class="text-gray-600">根据需求选择<code class="bg-gray-100 px-1 py-0.5 rounded">ByteToMessageDecoder</code>、<code class="bg-gray-100 px-1 py-0.5 rounded">ReplayingDecoder</code>或<code class="bg-gray-100 px-1 py-0.5 rounded">MessageToMessageDecoder</code></p>
                        </div>
                        <div class="timeline-item">
                            <h5 class="font-semibold text-gray-800">2. 实现高效的数据处理</h5>
                            <p class="text-gray-600">减少内存拷贝，利用ByteBuf的引用计数和切片操作</p>
                        </div>
                        <div class="timeline-item">
                            <h5 class="font-semibold text-gray-800">3. 添加适当的共享性控制</h5>
                            <p class="text-gray-600">使用<code class="bg-gray-100 px-1 py-0.5 rounded">@Sharable</code>注解标记可共享的处理器</p>
                        </div>
                        <div class="timeline-item">
                            <h5 class="font-semibold text-gray-800">4. 进行资源管理</h5>
                            <p class="text-gray-600">确保正确释放ByteBuf和其他资源</p>
                        </div>
                    </div>
                </div>
            </div>
        </section>
    </div>

    <!-- Footer -->
    <footer class="bg-gray-900 text-gray-300 py-12">
        <div class="container mx-auto max-w-6xl px-4">
            <div class="flex flex-col md:flex-row justify-between items-center">
                <div class="mb-6 md:mb-0">
                    <h3 class="text-xl font-bold text-white mb-2">技术小馆</h3>
                    <p class="text-gray-400">探索技术奥秘，分享编程心得</p>
                </div>
                <div>
                    <a href="http://www.yuque.com/jtostring" class="text-blue-400 hover:text-blue-300 transition duration-300 flex items-center">
                        <i class="fas fa-external-link-alt mr-2"></i> http://www.yuque.com/jtostring
                    </a>
                </div>
            </div>
            <div class="border-t border-gray-800 mt-8 pt-8 text-center text-gray-500 text-sm">
                &copy; 2023 技术小馆. 保留所有权利.
            </div>
        </div>
    </footer>

    <script src="https://cdn.jsdelivr.net/npm/mermaid@latest/dist/mermaid.min.js"></script>
    <script>
        mermaid.initialize({
            startOnLoad: true,
            theme: 'dark',
            flowchart: {
                useMaxWidth: true,
                htmlLabels: true,
                curve: 'basis'
            }
        });
    </script>
</body>
</html>
```